home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_tem_introcut.cog < prev    next >
Text File  |  1999-11-15  |  12KB  |  456 lines

  1. # Jones 3D Cog Script
  2. #
  3. # TEM_IntroCut.cog
  4. #
  5. # [TRM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13.     message     startup
  14.     message     user0
  15.     message     entered
  16.     message     pulse
  17.     
  18.     # ** local things **
  19.     thing       player          local
  20.     thing       dustThing       local
  21.     thing       rocks           local
  22.     thing       indy            local
  23.     thing       indyTarget      local
  24.     
  25.     # ** things **
  26.     thing       introCam
  27.     thing       camTarget
  28.     thing       target0
  29.     thing       target1
  30.     thing       target2
  31.     thing       target3
  32.     thing       tempCam
  33.     thing       fader
  34.     thing       dustPos     # dust cloud origin
  35.     thing       debrisPos   # debris origin
  36.     
  37.     thing       interpPos1
  38.     thing       interpPos2
  39.     #thing       lookPos0
  40.     thing       lookPos1
  41.     
  42.     surface     landed          mask=0x004
  43.     surface     shakeMe
  44.     
  45.     template    tplActor=indy_sh_actor      local
  46.     template    dust=dustcloud              local
  47.     template    debris0=stoneshrapbm_nc     local
  48.     template    tplActor=indy_sh_actor      local
  49.     template    tpl_Debris=+dummy_debris    local
  50.     template    tpl_Ghost=ghost             local
  51.     
  52.     material    dustMat=gen_a4sfx_dustcloud.mat                local
  53.     material    mat1=tem_4wall_blocks_broken_imp1.mat       local
  54.     
  55.     keyframe    inFall=in_jump_fall.key             local
  56.     keyframe    inStand1=0in_stand4.key             local
  57.     keyframe    inThinking=0in_thinking_4_4.key     local
  58.     keyframe    inStand2=0in_stand1_bd_4.key        local
  59.     keyframe    inLand=in_jump_land_soft.key        local
  60.     
  61.     # ** voice lines **
  62.     sound       inIntro=tm01j01.wav     local   # I never saw this place...
  63.     sound       inHmm=Inxj146.wav       local   # hmm...
  64.     sound       inOof=inxj016a.wav      local   # ooof...
  65.     
  66.     # ** sound fx **
  67.     sound       sfx_Charge=nub_aethlight_on_c.wav       local   # temp charging sound
  68.     sound       sfx_Explode=shw_wall_crash.wav          local
  69.     sound       in_Land=fol_in_landhardecho.wav         local
  70.     
  71.     sound       mus_Intro=mus_gen_awesome1.wav  local
  72.     
  73.     cog         cameraShake
  74.     
  75.     vector      dustStart       local
  76.     vector      dustEnd         local
  77.     vector      camFocus        local
  78.     vector      posOffSet       local
  79.     vector      angOffset       local
  80.     vector      vecTemp         local
  81.     
  82.     int         falling         local
  83.     int         speak1          local
  84.     int         inTrack         local
  85.     int         i               local
  86.     int         numDebris=40    local
  87.     int         shake=0         local
  88.     int         vibe            local
  89. #    int         dontPlay=1      local
  90.  
  91.     int            bSeen=0            local
  92.     
  93. end
  94.  
  95. # ========================================================================================
  96.  
  97. code
  98.  
  99. startup:
  100.  
  101.     SetMasterCog(GetSelfCog()); # RT: Set master cog so we get autosave/restore message
  102.  
  103.     Sleep(0.001); # Let engine get set up
  104.  
  105.     player = GetLocalPlayerThing();
  106.     
  107.     # Start on black...
  108.     SetCameraLookInterp(2, 0);
  109.     SetCameraPosInterp(2, 0);
  110.     SetCameraFocus(2, introCam);
  111.     SetCameraSecondaryFocus(2, player);
  112.     SetCurrentCamera(2);
  113.     SetCameraFOV(90, 0, 0.0);
  114.     
  115.     return;
  116.  
  117. # ..............................................................................
  118.  
  119. user0: # RT: Indicates that autosave/restore has completed...
  120.  
  121.     if (bSeen) return; # RT
  122.     bSeen = 1;
  123.  
  124.     # turn on red fog
  125.     SetFog(1, '0.50 0.05 0.05', 15, 180);
  126.  
  127.     # switch cam
  128.     SetCameraLookInterp(2, 0);
  129.     SetCameraPosInterp(2, 0);
  130.     SetCameraFocus(2, introCam);
  131.     SetCameraSecondaryFocus(2, player);
  132.     SetCurrentCamera(2);
  133.     SetCameraFOV(90, 0, 0.0);
  134.     
  135.     #AttachThingToThing(fader, introCam);
  136.     ThingFadeAnim(fader, 1, 0, 2.0, 0);
  137.     SetCollideType(fader, 0);
  138.     
  139.     # turn on camera interp
  140.     SetCameraInterpSpeed(2, 10.5);
  141.     SetCameraPosInterp(2, 1);
  142.     
  143.     Sleep(0.01);
  144.     
  145.     # insure that the player is opaque
  146.     SetThingAlpha(player, 1.0);
  147.     
  148.     # start cutscene and disable player
  149.     StartCutscene(2);
  150.     SetActorFlags(player, 0x200000);
  151.     
  152.     # make imp1 availble (temp)
  153.     ChangeInv(player, 14, 1.0);
  154.     SetInvAvailable(player, 14, 1);
  155.         
  156.     # move intro cam towards wall
  157.     SetCameraFocus(2, interpPos1);
  158.     
  159.     MoveToFrame(fader, 1, 2.7);
  160.     
  161.     # preload explosion sfx
  162.     #PlaySoundLocal(sfx_Explode, 0.0, 0.0, 0x0, 0);
  163.     
  164.     # play intro music
  165.     PlaySoundLocal(mus_Intro, 1.0, 0.0, 0x0, 0);
  166.     
  167.     Sleep(8.0);
  168.     
  169.     # draw imp#1
  170.     SelectWeapon(player, 14);
  171.     #SelectWeaponWait(player, 14);
  172.     
  173.     # fire up imp1
  174.     #PlaySoundLocal(sfx_Charge, 1.0, 0.0, 0x0, 0);
  175.     SetThingLight(dustThing, '0.10 0.10 1.0', 20.0, 2.0);
  176.     
  177.     Sleep(1.0);
  178.     
  179.     # add some camera shake
  180.     #SetPulse(0.1);
  181.     
  182.     # rest to let imp1 warm up
  183.     Sleep(2.0);
  184.     
  185.     # kill dynamic light
  186.     SetThingLight(dustThing, '0.0 0.0 0.0', 15.0, 0.5);
  187.         
  188.     # create dust cloud
  189.     dustStart = VectorSet(0.2, 0.2, 0.5);
  190.     dustEnd    = VectorSet(1.2, 1.2, 0.0);
  191.     dustThing = CreateThing(dust, dustPos);
  192.     CaptureThing(dustThing);
  193.     
  194.     # animate dust cloud
  195.     SetMaterialCel(dustMat, 0);
  196.     MaterialAnim(dustMat, 8.0, 1);
  197.     AnimateSpriteSize(dustThing, dustStart, dustEnd, 7.0);
  198.     
  199.     # alter adjoin
  200.     #SetFaceGeoMode(shakeMe, 0);     # no draw
  201.     SetWallCel(shakeMe, 1);        # set back to this when texture is fixed
  202.     
  203.     # create debris
  204.     CreateThing(tpl_Debris, debrisPos);
  205.     
  206.     # play explosion sfx
  207.     PlaySoundLocal(sfx_Explode, 1.0, 0.0, 0x0, 0);
  208.     
  209.     # stop cameraShake
  210.     #SetPulse(0.0);
  211.     
  212.     Sleep(1.0);
  213.     
  214.     # put away imp#1
  215.     DeselectWeapon(player);
  216.     DeselectWeaponWait(player);
  217.     
  218.     # create actor at player pos
  219.     indy = CreateThing(tplActor, player);
  220.     CaptureThing(indy);
  221.     
  222.     # disable actor indy
  223.     AISetCutsceneMode(indy);
  224.     
  225.     # change secondary focus to indy
  226.     SetCameraSecondaryFocus(2, indy);
  227.     
  228.     # outfit actor indy
  229.     CopyPlayerHolsters(player, indy);
  230.     
  231.     # hide player show indy
  232.     SetThingFlags(player, 0x80000);
  233.     ClearThingFlags(indy, 0x80000);
  234.     
  235.     # walk indy to ledge
  236.     AISetMoveSpeed(indy, 1.0);
  237.     AiSetLookThing(indy, camTarget);
  238.     AiSetMoveThing(indy, target0, 1);
  239.     
  240.     # say hmmm voice line
  241.     PlayVoice(indy, inHmm, 1.0, 1);
  242.     
  243.     Sleep(1.0);
  244.     
  245.     # indy jumps down
  246.     AISetMoveSpeed(indy, 4.0);
  247.     AiSetLookThing(indy, target2);
  248.     AiSetMoveThing(indy, target1, 1);
  249.     
  250.     # play falling key
  251.     falling = PlayKey(indy, inFall, 1, 0x14, 0);
  252.     
  253.     # move camTarget as he falls
  254.     SetCameraInterpSpeed(2, 0.9);
  255.     Sleep(0.01);
  256.     SetCameraFocus(2, interpPos2);
  257.     
  258.     return;
  259.  
  260. # ========================================================================================
  261.  
  262. entered:
  263.  
  264.     if(GetSenderRef() == landed)
  265.     {
  266.         AttachThingToSurf(indy, landed);
  267.         AttachThingToSurf(player, landed);
  268.         
  269.         ResetThing(indy);
  270.         
  271.         # oof!
  272.         PlaySoundLocal(inOof, 1.0, 0.0, 0x0, 0);
  273.         PlaySoundLocal(in_Land, 1.0, 0.0, 0x0, 0);
  274.         
  275.         # stop falling
  276.         SetActorHeadPYR(indy, '0.0 0.0 0.0');
  277.         StopKey(indy, falling, 0.2);
  278.         
  279.         # play land key
  280.         PlayKey(indy, inLand, 1, 0x12, 1);
  281.         
  282.         Sleep(0.5);
  283.         
  284.         # move indy to target3
  285.         AISetMoveSpeed(indy, 1.0);
  286.         AiSetMoveThing(indy, target3, 1);
  287.         
  288.         # move player into position
  289.         TeleportThing(player, target3);
  290.         Sleep(0.01);
  291.         CopyOrient(indy, player);
  292.         
  293.         Sleep(0.09);
  294.         
  295.         # create target at indy's position
  296.         camFocus = VectorAdd(VectorTransformToOrient(indy, '0.0 0.0 0.0'), GetThingPos(indy));
  297.         indyTarget = CreateThingAtPos(tpl_Ghost, GetThingSector(indy), camFocus, '0 0 0');
  298.         CaptureThing(indyTarget);
  299.     
  300.         AttachThingToThing(interpPos2, indyTarget);
  301.         Sleep(0.01);
  302.         
  303.         # turn off pos interp
  304.         SetCameraPosInterp(2, 0);
  305.         
  306.         Rotate(indyTarget, 160.0, 1, 9.0); #6
  307.         
  308.         Sleep(0.5);
  309.         
  310.         # indy speaks - arms crossed
  311.         speak1 = PlayVoice(indy, inIntro, 1.0, 0);
  312.         
  313.         inTrack = PlayKey(indy, inStand1, 2, 0x0, 0);
  314.         PlayKey(indy, inStand2, 4, 0x12, 1);
  315.         
  316.         SetCameraInterpSpeed(2, 7);   # 5 or 7 was 4.8
  317.         SetCameraLookInterp(2, 1);
  318.         Sleep(0.01);
  319.         SetCameraSecondaryFocus(2, lookPos1);
  320.         
  321.         PlayKey(indy, inThinking, 4, 0x12, 1);
  322.         StopKey(indy, inTrack, 0.5);
  323.         WaitForSound(speak1);
  324.         
  325.         #Sleep(1.0);
  326.         
  327.         #CopyOrientAndPos(indy, player);
  328.         
  329.         # move player into position
  330.         #TeleportThing(player, target3);
  331.         #Sleep(0.01);
  332.         #CopyOrient(indy, player);
  333.         
  334.         # stop any unfinished animations
  335.         ResetThing(player);
  336.         #ResetThing(indy);
  337.         
  338.         # show player hide indy
  339.         SetThingFlags(indy, 0x80000);
  340.         ClearThingFlags(player, 0x80000);
  341.         
  342.         # turn off camera interp
  343.         SetCameraPosInterp(2, 0);
  344.         SetCameraLookInterp(2, 0);
  345.     
  346.         #Sleep(0.1);
  347.         
  348.         # restore camera
  349.         SetCameraSecondaryFocus(2, player);
  350.         Sleep(0.01);
  351.         ResetCameraFOV(0, 0.0);
  352.         SetCameraPosition(1, GetThingPos(interpPos2));
  353.         #SetCameraPosition(1, GetThingPos(target2));
  354.         SetCurrentCamera(1);
  355.         
  356.         # restore player controls
  357.         ClearActorFlags(player, 0x200000);
  358.         EndCutscene();
  359.     }   
  360.     
  361.     return;
  362.  
  363. # ========================================================================================
  364.  
  365. pulse:
  366.  
  367.     shake = shake + 1;
  368.     vibe = RandBetween(1, 4);
  369.     
  370.     if (shake <= 5)
  371.     {
  372.         if(vibe == 1)
  373.         {
  374.             posOffset = '0.01 -0.01 0.005'; #2
  375.             angOffset = '0.005 0.00 -0.005';
  376.         }
  377.         
  378.         if(vibe == 2)
  379.         {
  380.             posOffset = '0.005 0.01 -0.01'; #3
  381.             angOffset = '-0.005 0.005 -0.00';
  382.         }
  383.         
  384.         if(vibe == 3)
  385.         {
  386.             posOffset = '-0.015 0.00 0.01'; #4 was .01x
  387.             angOffset = '0.00 0.00 0.01';
  388.         }
  389.         
  390.         if(vibe == 4)
  391.         {
  392.             posOffset = '-0.01 0.00 -0.005'; #1
  393.             angOffset = '0.00 -0.005 0.005';
  394.         }
  395.     }
  396.     
  397.     else if (shake <= 10)
  398.     {
  399.         if(vibe == 1)
  400.         {
  401.             posOffset = '-0.02 0.00 0.02'; #4 was .01x
  402.             angOffset = '0.00 0.00 0.01';
  403.         }
  404.         
  405.         if(vibe == 2)
  406.         {
  407.             posOffset = '0.01 0.02 -0.02'; #3
  408.             angOffset = '-0.01 0.01 -0.01';
  409.         }
  410.         
  411.         if(vibe == 3)
  412.         {
  413.             posOffset = '-0.025 0.00 -0.01'; #1 was .02x
  414.             angOffset = '0.00 -0.01 0.01';
  415.         }
  416.         
  417.         if(vibe == 4)
  418.         {
  419.             posOffset = '0.02 -0.02 0.01'; #2
  420.             angOffset = '0.01 0.00 -0.01';
  421.         }
  422.     }
  423.     
  424.     else if (shake <= 30)
  425.     {
  426.         if (vibe == 1)
  427.         {
  428.             posOffset = '-0.05 0.00 -0.02';
  429.             angOffset = '0.00 -0.02 0.02';
  430.         }
  431.         if (vibe == 2)
  432.         {
  433.             posOffset = '0.05 -0.05 0.02';
  434.             angOffset = '0.02 0.00 -0.02';
  435.         }
  436.         if (vibe == 3)
  437.         {
  438.             posOffset = '0.02 0.05 -0.05';
  439.             angOffset = '-0.02 0.002 -0.02';
  440.         }
  441.         if (vibe == 4)
  442.         {
  443.             posOffset = '-0.02 0.0 0.05';
  444.             angOffset = '0.00 0.00 0.02';
  445.         }
  446.     }
  447.     
  448.     SetPOVShake(posOffSet, angOffSet, 200.0, 200.0);
  449.     
  450.     return;
  451.  
  452. # ========================================================================================
  453.  
  454. end
  455.  
  456.